function connectDatabase() {
    var dbUrl = document.getElementById("dbUrl").value;
    var username = document.getElementById("username").value;
    var password = document.getElementById("password").value;

    var data = {
        dbUrl: dbUrl,
        username: username,
        password: password
    };

    // 使用Ajax发送POST请求
    var xhr = new XMLHttpRequest();
    xhr.open("POST", "/connect", true);
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4 && xhr.status === 200) {
            var response = JSON.parse(xhr.responseText);
            document.getElementById("result").innerText = response.message;
        }
    };
    xhr.send(JSON.stringify(data));
}